package com.yunji.aggregate.model.dto.container;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.google.common.collect.Sets;
import com.yunji.common.annotation.Excel;
import com.yunji.common.base.PageDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.CollectionUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.Set;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.cabinet.vo
 * @Title: ContainerParam
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-04-23 15:45:07      V1.0        HuaAo       新建类
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class CabinetParam extends PageDTO implements Serializable {
    private static final long serialVersionUID = 7316659384462427665L;
    private Long containerId;
    private Long managerId;
    private Long belongId;
    private String qrCode;
    private String chipSn;
    private String chipImei;
    @ApiModelProperty("在线状态 0-离线 1-在线")
    private Integer onlineStatus;
    @ApiModelProperty("电压状态 0-低电 1-正常")
    private Integer battleStatus;
    @ApiModelProperty("运行状态 0-异常 1-正常")
    private Integer runtimeStatus;
    private Integer useStatus;
    private String typeCode;
    private Long staffId;
    private Long agentId;
    private Long siteId;
    private Long templateId;
    private Date bindTime;
    private String containerName;
    private String siteName;
    private String agentName;
    private String locationName;
    private String locationTypeName;

    @ApiModelProperty("父所属ID")
    private Long parentId;

    @ApiModelProperty("用户类型")
    private String userType;

    @ApiModelProperty("低的销售笔数")
    @Excel(name = "低的销售笔数", width = 15)
    private Integer minTotalCount;

    @ApiModelProperty("高的销售笔数")
    @Excel(name = "高的销售笔数", width = 15)
    private Integer maxTotalCount;

    @ApiModelProperty("低的销售金额")
    @Excel(name = "低的销售金额", width = 15)
    private BigDecimal minTotalAmount;

    @ApiModelProperty("高的销售金额")
    @Excel(name = "高的销售金额", width = 15)
    private BigDecimal maxTotalAmount;

    @ApiModelProperty("低的创建时间")
    @Excel(name = "低的创建时间", width = 15)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startCreateTime;

    @ApiModelProperty("高的创建时间")
    @Excel(name = "高的创建时间", width = 15)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date closeCreateTime;

    @ApiModelProperty("三合一查询编码")
    @Excel(name = "三合一查询编码", width = 15)
    private String code;

    @ApiModelProperty("搜索字段")
    private String searchFiled;

    @ApiModelProperty("无货：0 有货 1 缺货 2")
    private Integer cellStatus;

    private Integer status;
    private Integer lackStatus;

    @ApiModelProperty("天数时长(传分钟)")
    private Integer cycleMinutes;

    @ApiModelProperty("绑定查询")
    private Integer bindSearch;

    @ApiModelProperty("点位ID")
    private Long locationId;

    @Override
    public Set<String> getOrderFields() {
        if (CollectionUtils.isEmpty(super.getOrderFields())){
            super.setOrderDesc(true);
            super.setOrderFields(Sets.newHashSet("createTime"));
        }
        return super.getOrderFields();
    }

}